<!--!
This file is a part of MediaDrop (http://www.mediadrop.net),
Copyright 2009-2013 MediaCore Inc., Felix Schwarz and other contributors.
For the exact contribution history, see the git revision log.
The source code contained in this file is licensed under the GPLv3 or
(at your option) any later version.
See LICENSE.txt in the main project directory, for more information.
-->
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/"
      xmlns:i18n="http://genshi.edgewall.org/i18n"
      xmlns:xi="http://www.w3.org/2001/XInclude"
      py:strip="">

	<py:def function="paginated_tfoot(paginator, colspan=1, radius=2, show_if_single_page=False, link_args={})">
		<tfoot py:if="paginator.page_count > (not show_if_single_page and 1 or 0)" py:with="
			leftmost_page = max(paginator.first_page, paginator.page - radius);
			rightmost_page = min(paginator.last_page, paginator.page + radius);
		">
			<a py:def="pagelink(page, text=None, extraclass='')"
			   href="${h.url_for(page=page, **link_args)}"
			   class="pager-link underline-hover btn inline ${extraclass}"><span>${text or page}</span></a>
			<tr>
				<td class="box-foot right" colspan="${colspan}">
					<div class="pager">
						<a py:if="paginator.page &gt; paginator.first_page" py:replace="pagelink(paginator.page - 1, '&laquo;', 'pager-previous')" />
						<py:if test="leftmost_page > paginator.first_page">
							<a py:replace="pagelink(paginator.first_page)" />
							<span py:if="leftmost_page - paginator.first_page > 1" class="pager-dotdot">&#8230;</span>
						</py:if>
						<py:for each="page in xrange(leftmost_page, rightmost_page + 1)" py:choose="">
							<span py:when="paginator.page == page" class="pager-current btn inline active unclickable"><span>${page}</span></span>
							<a py:otherwise="" py:replace="pagelink(page)" />
						</py:for>
						<py:if test="paginator.last_page > rightmost_page">
							<span py:if="paginator.last_page - rightmost_page > 1" class="pager-dotdot">&#8230;</span>
							<a py:replace="pagelink(paginator.last_page)" />
						</py:if>
						<a py:if="paginator.page &lt; paginator.last_page" py:replace="pagelink(paginator.page + 1, '&raquo;', 'pager-next')" />
					</div>
				</td>
			</tr>
		</tfoot>
	</py:def>

	<py:def function="comment_stats_box(link, total=None, published=None, unreviewed=None, trash=None, query=None)">
		<?python
		if total is None:
			total = query.count()
		if published is None:
			published = query.published().count()
		if unreviewed is None:
			unreviewed = query.reviewed(False).count()
		if trash is None:
			trash = query.trash().count()
		?>
		<div class="box">
			<div class="box-head">
				<a href="${link}"
				   id="go-view-content" class="box-head-sec" target="_blank"
				   title="Moderate comments">Moderate</a>
				<h1>Comments</h1>
			</div>
			<table id="comments-table" cellpadding="0" cellspacing="0">
				<tr class="comments-total">
					<td class="comments-count" py:content="total" />
					<i18n:choose numeral="total">
						<td i18n:singular="">Comment</td>
						<td i18n:plural="">Comments</td>
					</i18n:choose>
				</tr>
				<tr class="comments-published">
					<td class="comments-count" py:content="published" />
					<td>Published</td>
				</tr>
				<tr class="${(unreviewed and 'comments-unreviewed') or 'comments-trash'}">
					<td class="comments-count" py:content="unreviewed" />
					<td>Unreviewed</td>
				</tr>
				<tr class="comments-trash">
					<td class="comments-count" py:content="trash" />
					<td>Trash</td>
				</tr>
			</table>
		</div>
	</py:def>

</html>
